<?php

$use_encoded_mode=1;

if($_COOKIE["use_encoded_mode"] == "on") $use_encoded_mode=1;
if($_COOKIE["use_encoded_mode"] == "off") $use_encoded_mode=0;
if($_POST["use_encoded_mode"] == "on" ) {
  $use_encoded_mode=1;
}
if($_POST["use_encoded_mode"] == "off") {
  $use_encoded_mode=0;
}

if(! $_GET["full"] or !$use_encoded_mode){
$url=LURL.$_SERVER["REQUEST_URI"];

?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head profile="http://gmpg.org/xfn/11">


<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<title><?php bloginfo('name');  ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> 
--<?php wp_title(); ?></title>

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/print.css" type="text/css" media="print" />
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />  <?php wp_head(); ?>

<?php
	
if($use_encoded_mode){
?>

<script type="text/javascript" src="xmlhttp.js"></script>
<script src="./new_base64.js" type="text/javascript"> </script>
<script src="./utf.js" type="text/javascript"> </script>
<script type="text/javascript">

<!--

var TimeUsed;  
var LoadBeginTime;

function statusCheck()
{
	if ((httpObj.readyState == 4) && (httpObj.status == 200))
	{
		displayData();
	}
}
function changeTitle(){
	
//	var txt = utf8to16(base64decode(document.title)); 
//	document.title = txt;
}

function loadTextFile(url)
{
//	var txt = utf8to16(base64decode(document.title)); 
//	document.title = txt;

	httpObj = createXMLHttpRequest(displayData);
	if (httpObj)
	{
		LoadBeginTime = new Date();
		httpObj.open("GET","<?php echo "http://".MAINDOMAIN.WEBROOT; ?>/wp-content/themes/encoded_leet/read_html.php?url="+url,true);
		httpObj.send(null);
		timerID = setTimeout("httpAbort()",10000); 
		//document.getElementById("mydisp").innerHTML = "";
	}
	return false;
}
function displayData()
{
	if (httpObj.readyState == 4)
	{
		try {
			statusCode[""+httpObj.status]();
		}catch(e){
			return;
		}
	}
}

statusCode = new Array();
statusCode["200"] = function (){
	var pattern = /(http:\/\/.*)/;
	var txt =  httpObj.responseText; 
	var i=0;
	var newtxt="";
	var BeginTime;
	var EndTime;

	

	for(i=1;i<txt.length;i++){
		newtxt += String.fromCharCode( ( ((txt.charCodeAt(i)-43-(i)-txt.charCodeAt(0))%82+82)%82)+43 );
		//newtxt += String.fromCharCode( txt.charCodeAt(i));
	}

        newtxt=txt;

	//BeginTime = new Date();
	//txt = base64.decode(newtxt,"utf-8");
	txt = utf8to16(base64decode(newtxt));
        //txt = newtxt;
	//EndTime = new Date();
	//TimeUsed = EndTime-LoadBeginTime;

 	document.getElementById("mydisp").innerHTML = txt;// + (EndTime-BeginTime) +  " of "+ TimeUsed;
	document.getElementById("header").focus(); 
    	EndTime = now.getTime();
	return false;
}
statusCode["401"] = function (){ document.getElementById("disp").innerHTML = "错误401"; }
statusCode["403"] = function (){ document.getElementById("disp").innerHTML = "错误403"; }
statusCode["404"] = function (){ document.getElementById("disp").innerHTML = "错误404"; }
statusCode["500"] = function (){ document.getElementById("disp").innerHTML = "错误500"; }

function httpAbort()
{
	httpObj.abort();
	txt = "Timeout 5 sec....<br>";
	document.getElementById("mydisp").innerHTML = txt; 
}

// -->
</script>
<?php
} //end of if use encoded mode.
?>


</head>
<?php 
if($use_encoded_mode) 
	echo "<body onLoad=\"loadTextFile('$url');\">";
else
	echo "<body onLoad=\"changeTitle();\">";
?>


<div id="page">
  <div id="header">
  <div id="headerlogo">
<div style="position:absolute;top:10px; right:20px;">

</div>
	  <h1><a href="<?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
	  <div class="description"><?php bloginfo('description'); ?></div>

	</div>
    
	<ul id="nav">
	  <li class="page_item"><a href="<?php echo get_settings('home'); ?>/" title="Home">Home</a></li>
	  <?php wp_list_pages('sort_column=menu_order&depth=1&title_li=');?>
         </ul>

      <?php include (TEMPLATEPATH . '/searchform.php'); ?>
<form action="." method="post">
<select id="encrypt" name="use_encoded_mode" onchange="this.form.submit();" >
<?php
if($use_encoded_mode )
{
echo "<option value='on' selected > 启用隐身衣</option>";
echo "<option value='off' > 关闭隐身衣</option>";
}
else
{
echo "<option value='off' selected >关闭隐身衣</option>";
echo "<option value='on' >启用隐身衣</option>";
}

?>
</select>
</form>
  

  </div>
<!--/header -->

<?php 
if($use_encoded_mode){
?>
<div id="mydisp">
<div align=center>
<br>
<img src="flower.png" align=center>
<br>

如果加载时间过长，请在右上方选择“关闭隐身衣”。
<br>
</div>
<?php
}
?>

<?php

}

if(!$use_encoded_mode){
	$_GET["full"]=1;
}


?>
